/* eslint-disable consistent-return */
/* eslint-disable react/jsx-indent */
import React, { PureComponent } from 'react';
import { DeleteOutlined, EditOutlined } from '@ant-design/icons';
import { Form } from '@ant-design/compatible';
import '@ant-design/compatible/assets/index.css';
import { Row, Col, Modal, Select, Button, Tabs, DatePicker, InputNumber, message } from 'antd';
import moment from 'moment';
import styles from './index.less';
import DictCode from '../../../components/DictCode';
import { urlParse } from '@/utils/utils';
import HOCSelect from '@/components/AntDesign/Select';

const FormItem = Form.Item;
const { TabPane } = Tabs;
const { Option } = Select;
const { MonthPicker } = DatePicker;

@Form.create()
class LocalPolicy extends PureComponent {
  state = {
    modalVisible: false, // 模态框的开关
    defaultSwitch: false, // 是新增还是修改的开关，新增的话时间没有默认值，修改的有默认值
    isnableState: '',
    effectiveTime: '0',
    duplicateTaskModal: false, // 生成替数任务弹框
    taskObj: {}, // 替数任务数据
    differHdlWay: null, // 差额
  };

  componentDidMount() {
    const { location } = this.props;
    const url = location.search;
    const { state } = urlParse(decodeURIComponent(url));
    if (state) {
      this.setState({
        isnableState: state,
      });
    } else {
      this.setState({
        isnableState: '',
      });
    }
  }

  // 新增数据
  addDate = () => {
    const { dispatch } = this.props;
    this.setState({
      modalVisible: true,
      defaultSwitch: false,
      effectiveTime: '0',
    });
    dispatch({
      type: 'localpolicy/changeModify',
      payload: '2',
    });
  };

  // 模态框显隐
  handleModalVisible = flag => {
    this.setState({
      modalVisible: !!flag,
    });
  };

  // 切换险种
  bizTabChange = value => {
    const { dispatch, localpolicy, hshdRegFlag } = this.props;
    // 一个里面修改当亲险种（存起来。清空右侧的数据）
    let paramet = {};
    if (String(hshdRegFlag) === '2') {
      paramet = {
        insLsPkgId: localpolicy.groupId,
        type: value,
      };
    } else {
      paramet = {
        insLsPkgId: localpolicy.groupId,
        joinIdeId: localpolicy.payerIds,
        type: value,
      };
    }
    // 添加完以后获取该缴费人员下该险种下的所有信息
    dispatch({
      type: 'localpolicy/insuranceInformation',
      payload: paramet,
    });
  };

  // 提交数据
  submitData = () => {
    const { form } = this.props;
    form.validateFields((err, values) => {
      if (!err) {
        const { dispatch, localpolicy } = this.props;
        if (Number(localpolicy.isModify) === 2) {
          if (localpolicy.groupId) {
            const parameter = {
              ...values, //
              insLsPkgId: localpolicy.groupId, // 组id
              joinIdeId: localpolicy.payerIds, // 缴费人员id
              beginDate: moment(values.empTime).valueOf(),
              type: localpolicy.insuranceIds, // 险种id
              isModify: localpolicy.isModify, // 是新增还是修改
              govPostTime: moment(values.govPostTime).valueOf(),
            };
            dispatch({
              type: 'localpolicy/saveInsurance',
              payload: parameter,
              callback: response => {
                if (response.success) {
                  this.setState({
                    modalVisible: false,
                  });
                  // 判断生成替数任务规则弹框是否显示
                  if (response.data && response.data.isShowFlag) {
                    if (Number(response.data.isShowFlag) === 1) {
                      this.setState({
                        duplicateTaskModal: true,
                        taskObj: response.data,
                      });
                    } else {
                      const paramet = {
                        insLsPkgId: localpolicy.groupId,
                        joinIdeId: localpolicy.payerIds,
                        type: localpolicy.insuranceIds,
                      };
                      // 添加完以后获取该缴费人员下该险种下的所有信息
                      dispatch({
                        type: 'localpolicy/insuranceInformation',
                        payload: paramet,
                      });
                    }
                  }
                }
              },
            });
          } else {
            dispatch({
              type: 'localpolicy/nextStep',
              payload: {
                areaId: localpolicy.areaId,
                insLsPkgName: localpolicy.insLsPkgName,
                hshdRegFlag: localpolicy.hshdRegFlag,
              },
            }).then(res => {
              if (res.success) {
                const parameter = {
                  ...values, //
                  insLsPkgId: res.data, // 组id
                  joinIdeId: localpolicy.payerIds, // 缴费人员id
                  beginDate: moment(values.empTime).valueOf(),
                  type: localpolicy.insuranceIds, // 险种id
                  isModify: localpolicy.isModify, // 是新增还是修改
                  govPostTime: moment(values.govPostTime).valueOf(),
                };
                dispatch({
                  type: 'localpolicy/saveInsurance',
                  payload: parameter,
                  callback: response => {
                    if (response.success) {
                      this.setState({
                        modalVisible: false,
                      });
                      // 判断生成替数任务规则弹框是否显示
                      if (response.data && response.data.isShowFlag) {
                        if (Number(response.data.isShowFlag) === 1) {
                          this.setState({
                            duplicateTaskModal: true,
                            taskObj: response.data,
                          });
                        } else {
                          const paramet = {
                            insLsPkgId: res.data,
                            joinIdeId: localpolicy.payerIds,
                            type: localpolicy.insuranceIds,
                          };
                          // 添加完以后获取该缴费人员下该险种下的所有信息
                          dispatch({
                            type: 'localpolicy/insuranceInformation',
                            payload: paramet,
                          });
                        }
                      }
                    }
                  },
                });
              } else {
                message.warning(res.message || '服务端未知错误');
              }
            });
          }
        } else {
          const parameter = {
            ...values, //
            locStdId: localpolicy.viewDataMessage.locStdId, // 这个险种下的某个时间段的修改
            type: localpolicy.insuranceIds, // 险种id
            joinIdeId: localpolicy.payerIds, // 缴费人员id
            isModify: localpolicy.isModify, // 是新增还是修改
            vno: localpolicy.viewDataMessage.vno,
            beginDate: moment(values.empTime).valueOf(),
            govPostTime: moment(values.govPostTime).valueOf(),
          };
          dispatch({
            type: 'localpolicy/saveInsurance',
            payload: parameter,
            callback: response => {
              if (response.success) {
                this.setState({
                  modalVisible: false,
                });
                // 判断生成替数任务规则弹框是否显示
                if (response.data && response.data.isShowFlag) {
                  if (Number(response.data.isShowFlag) === 1) {
                    this.setState({
                      duplicateTaskModal: true,
                      taskObj: response.data,
                    });
                  } else {
                    const paramet = {
                      insLsPkgId: localpolicy.groupId,
                      joinIdeId: localpolicy.payerIds,
                      type: localpolicy.insuranceIds,
                    };
                    // 添加完以后获取该缴费人员下该险种下的所有信息
                    dispatch({
                      type: 'localpolicy/insuranceInformation',
                      payload: paramet,
                    });
                  }
                }
              }
            },
          });
        }
      }
    });
  };

  // 删除时间 icon
  deleteTime = timeitem => {
    const { dispatch } = this.props;
    const parame = {
      list: [
        {
          locStdId: timeitem.locStdId,
          vno: timeitem.vno,
        },
      ],
    };
    dispatch({
      type: 'localpolicy/deletetimes',
      payload: parame,
    });
  };

  // 禁止的时间
  disabledDate = (startValue, limitValue) => {
    if (!startValue) {
      return false;
    }
    return startValue.valueOf() < moment(limitValue).valueOf();
  };

  // 修改险种
  saveRiskmessage = (timeitem, e, index) => {
    const { dispatch, form } = this.props;
    form.resetFields();
    this.setState({
      modalVisible: true,
      defaultSwitch: true,
      effectiveTime: index,
    });
    dispatch({
      type: 'localpolicy/viewData',
      payload: { timeitem, e },
    });
  };

  // 点击查看右侧的
  onTimeButton = timeitem => {
    const { dispatch } = this.props;
    dispatch({
      type: 'localpolicy/viewData',
      payload: { timeitem },
    });
  };

  //  企业进位规则 和 个人进位规则可选择的时候获取到id      ( 改变的时候需要改变model成的数据 )
  // 选择 企业进位规则 和 个人进位规则

  // 隐藏生成替数任务弹框
  duplicateTaskCancel = () => {
    this.setState({ duplicateTaskModal: false });
  };

  // 生成替数任务弹框的确定按钮
  duplicateTaskOk = () => {
    const { differHdlWay, taskObj } = this.state;
    const { dispatch, localpolicy } = this.props;
    if (!differHdlWay) {
      message.warning('请选择差额账单处理方式');
      return false;
    }
    // 替数任务提交数据
    dispatch({
      type: 'localpolicy/insReplacePolicy',
      payload: {
        ...taskObj,
        differHdlWay,
      },
    }).then(res => {
      if (res.success) {
        const paramet = {
          insLsPkgId: localpolicy.groupId,
          joinIdeId: localpolicy.payerIds,
          type: localpolicy.insuranceIds,
        };
        // 添加完以后获取该缴费人员下该险种下的所有信息
        dispatch({
          type: 'localpolicy/insuranceInformation',
          payload: paramet,
        });
        this.setState({ duplicateTaskModal: false });
      } else {
        message.warning(res.message || '社保生成替数任务：服务器端错误');
      }
    });
  };

  // 选择差额账单数据
  getValue = e => {
    this.setState({
      differHdlWay: e.target.value,
    });
  };

  render() {
    const { form, viewDataMessage, insuranceInformationData, localpolicy, isaddBtn } = this.props;
    const { changeDataMessage } = localpolicy;
    const formItemLayout = {
      labelCol: { md: { span: 15 } },
      wrapperCol: { md: { span: 9 } },
    };
    const formModalItemLayout = {
      labelCol: { md: { span: 5 } },
      wrapperCol: { md: { span: 17, offset: 0 } },
    };
    const formItemLayoutModal = {
      labelCol: { md: { span: 10 } },
      wrapperCol: { md: { span: 10 } },
    };
    const formItemRadioLayout = {
      labelCol: { md: { span: 8 } },
      wrapperCol: { md: { span: 14, offset: 0 } },
    };

    const { getFieldDecorator } = form;
    const {
      modalVisible,
      isnableState,
      defaultSwitch,
      duplicateTaskModal,
      taskObj,
      effectiveTime,
      disabledSwitch,
    } = this.state;
    return (
      <div style={{ margin: '16px 0 0 0' }}>
        <Row style={{ height: '54px', background: '#fafafa' }}>
          <Col
            style={{
              width: '200px',
              height: '54px',
              lineHeight: '54px',
              fontWeight: '900',
              float: 'left',
              textAlign: 'center',
            }}
          >
            政策类型
          </Col>
          <Col
            style={{
              width: '200px',
              height: '54px',
              lineHeight: '54px',
              fontWeight: '900',
              float: 'left',
              textAlign: 'center',
            }}
          >
            生效年月
          </Col>
          <Col
            style={{
              width: '200px',
              height: '54px',
              lineHeight: '54px',
              fontWeight: '900',
              float: 'left',
              textAlign: 'right',
              padding: '0 0 0 20px',
            }}
          >
            政策信息
          </Col>
        </Row>
        <Row>
          <Col style={{ width: '200px', float: 'left' }}>
            <Tabs
              activeKey={localpolicy.insuranceIds}
              tabPosition="left"
              onChange={this.bizTabChange}
              tabBarStyle={{
                width: '200px',
                height: '300px',
              }}
              className="tabsstyle"
            >
              {localpolicy.insureArr
                ? localpolicy.insureArr.map(bizItem => (
                    <TabPane
                      className="tabPanestyle"
                      tab={bizItem.itemName}
                      key={bizItem.itemCode}
                    />
                  ))
                : null}
            </Tabs>
          </Col>

          <Col style={{ width: '200px', float: 'left', background: '#fafafa' }}>
            <Col
              style={{
                height: 300,
                minHeight: 300,
                lineHeight: '25px',
                overflow: 'hidden',
                overflowY: 'scroll',
              }}
            >
              {Number(isaddBtn) === 1 ? (
                <Button
                  style={{ width: '100px', margin: '10px 40px 0 40px' }}
                  type="primary"
                  onClick={() => this.addDate(2)}
                >
                  + 新增年月
                </Button>
              ) : null}

              {insuranceInformationData.length === 0
                ? null
                : insuranceInformationData.map((timeitem, itemindex) => (
                    <div style={{ background: '#fafafa' }}>
                      <div
                        className={timeitem.active ? styles.activeButton : styles.noActiveButton}
                        onClick={() => this.onTimeButton(timeitem, 1)}
                        style={{
                          marginRight: 5,
                          marginTop: 10,
                          height: '48px',
                          lineHeight: '48px',
                          float: 'left',
                          width: '200px',
                          padding: '0 0 0 60px',
                          cursor: 'pointer',
                        }}
                      >
                        <span style={{ float: 'left' }}>
                          {moment(timeitem.beginDate).format('YYYY-MM')}
                        </span>

                        <div style={{ float: 'left' }}>
                          {Number(isaddBtn) === 1 ? (
                            <a
                              style={{ margin: '0 0 0 25px' }}
                              onClick={() => this.saveRiskmessage(timeitem, 1, itemindex)}
                            >
                              <EditOutlined />
                            </a>
                          ) : null}
                          {Number(itemindex) === 0 &&
                          Number(isaddBtn) === 1 &&
                          String(isnableState) === '1' ? (
                            <a
                              style={{ marginLeft: '10px' }}
                              onClick={() => this.deleteTime(timeitem)}
                            >
                              <DeleteOutlined />
                            </a>
                          ) : null}
                        </div>
                      </div>
                    </div>
                  ))}
            </Col>
          </Col>
          <Col span={13} style={{ loat: 'left' }}>
            <Row>
              <Col span={12}>
                <FormItem {...formItemLayout} label="企业基数上限">
                  <span>
                    {viewDataMessage.corpBaseUprLmt ||
                      (viewDataMessage.corpBaseUprLmt === 0 ? 0 : '--')}
                  </span>
                </FormItem>
              </Col>
              <Col span={12}>
                <FormItem {...formItemLayout} label="个人基数上限">
                  <span>
                    {viewDataMessage.empBaseUprLmt ||
                      (viewDataMessage.empBaseUprLmt === 0 ? 0 : '--')}
                  </span>
                </FormItem>
              </Col>
            </Row>
            <Row>
              <Col span={12}>
                <FormItem {...formItemLayout} label="企业基数下限">
                  <span>
                    {viewDataMessage.corpBaseLwrLmt ||
                      (viewDataMessage.corpBaseLwrLmt === 0 ? 0 : '--')}
                  </span>
                </FormItem>
              </Col>
              <Col span={12}>
                <FormItem {...formItemLayout} label="个人基数下限">
                  <span>
                    {viewDataMessage.empBaseLwrLmt ||
                      (viewDataMessage.empBaseLwrLmt === 0 ? 0 : '--')}
                  </span>
                </FormItem>
              </Col>
            </Row>
            <Row>
              <Col span={12}>
                <FormItem {...formItemLayout} label="企业基数进位规则">
                  <span>{viewDataMessage.corpBaseCarryRuleName || '--'}</span>
                </FormItem>
              </Col>
              <Col span={12}>
                <FormItem {...formItemLayout} label="个人基数进位规则">
                  <span>{viewDataMessage.empBaseCarryRuleName || '--'}</span>
                </FormItem>
              </Col>
            </Row>

            <Row>
              <Col span={12}>
                <FormItem {...formItemLayout} label="企业缴费比例">
                  <Col span={10}>
                    <span>
                      {viewDataMessage.corpProp || (viewDataMessage.corpProp === 0 ? 0 : '--')}
                    </span>
                  </Col>
                  <Col span={1} offset={1} style={{ position: 'absolute', top: 0, right: '-45px' }}>
                    %
                  </Col>
                </FormItem>
              </Col>

              <Col span={12}>
                <FormItem {...formItemLayout} label="个人缴费比例">
                  <Col span={10}>
                    <span>
                      {viewDataMessage.empProp || (viewDataMessage.empProp === 0 ? 0 : '--')}
                    </span>
                  </Col>
                  <Col span={1} offset={1} style={{ position: 'absolute', top: 0, right: '-45px' }}>
                    %
                  </Col>
                </FormItem>
              </Col>
            </Row>
            <Row>
              <Col span={12}>
                <FormItem {...formItemLayout} label="企业固定金额">
                  <span>
                    {viewDataMessage.corpFixSum || (viewDataMessage.corpFixSum === 0 ? 0 : '--')}
                  </span>
                </FormItem>
              </Col>
              <Col span={12}>
                <FormItem {...formItemLayout} label="个人固定金额">
                  <span>
                    {viewDataMessage.empFixSum || (viewDataMessage.empFixSum === 0 ? 0 : '--')}
                  </span>
                </FormItem>
              </Col>
            </Row>
            <Row>
              <Col span={12}>
                <FormItem {...formItemLayout} label="企业缴费进位规则">
                  <span>{viewDataMessage.corpCarryRuleName || '--'}</span>
                </FormItem>
              </Col>
              <Col span={12}>
                <FormItem {...formItemLayout} label="个人缴费进位规则">
                  <span>{viewDataMessage.empCarryRuleName || '--'}</span>
                </FormItem>
              </Col>
            </Row>
            <Row>
              <Col span={12}>
                <FormItem {...formItemLayout} label="政府发文时间">
                  <span>
                    {(viewDataMessage &&
                      viewDataMessage.govPostTime &&
                      moment(viewDataMessage.govPostTime).format('YYYY-MM-DD HH:mm')) ||
                      '--'}
                  </span>
                </FormItem>
              </Col>
            </Row>
          </Col>
        </Row>
        {modalVisible && (
          <Modal
            width={750}
            title="时间段信息"
            visible={modalVisible}
            okText="确定"
            cancelText="取消"
            onOk={this.submitData}
            destroyOnClose
            onCancel={() => this.handleModalVisible(false)}
          >
            <Form layout="horizontal">
              <Row style={{ margin: '0 auto' }}>
                <Row>
                  <FormItem {...formItemLayoutModal} label="生效年月">
                    {getFieldDecorator('empTime', {
                      rules: [{ required: true, message: '请选择时间段' }],
                      initialValue: defaultSwitch ? moment(changeDataMessage.beginDate) : null,
                    })(
                      <MonthPicker
                        format="YYYY-MM"
                        placeholder="请选择"
                        style={{ width: '220px', float: 'left' }}
                        disabled={String(effectiveTime) !== '0'}
                        disabledDate={startValue =>
                          this.disabledDate(startValue, localpolicy.rangeDate)
                        }
                        allowClear={false}
                      />
                    )}
                  </FormItem>
                  <div
                    style={{
                      width: '100%',
                      margin: '-10px 0 24px 0',
                      borderBottom: '1px dashed #ccc',
                    }}
                  />
                </Row>
                <Row>
                  <Col span={12}>
                    <FormItem {...formItemLayoutModal} label="企业基数上限">
                      {getFieldDecorator('corpBaseUprLmt', {
                        rules: [
                          {
                            required: true,
                            message: '小数点后不可超过2位',
                            pattern: /^-?\d+\.?\d{0,2}$/,
                          },
                        ],
                        initialValue: changeDataMessage.corpBaseUprLmt,
                      })(
                        <InputNumber
                          max={99999999.99}
                          min={0}
                          placeholder="请输入"
                          style={{ width: '156px' }}
                          disabled={disabledSwitch}
                        />
                      )}
                    </FormItem>
                  </Col>
                  <Col span={12}>
                    <FormItem {...formItemLayoutModal} label="个人基数上限">
                      {getFieldDecorator('empBaseUprLmt', {
                        rules: [
                          {
                            required: true,
                            message: '小数点后不可超过2位',
                            pattern: /^-?\d+\.?\d{0,2}$/,
                          },
                        ],
                        initialValue: changeDataMessage.empBaseUprLmt,
                      })(
                        <InputNumber
                          max={99999999.99}
                          min={0}
                          placeholder="请输入"
                          style={{ width: '156px' }}
                          disabled={disabledSwitch}
                        />
                      )}
                    </FormItem>
                  </Col>
                </Row>
                <Row>
                  <Col span={12}>
                    <FormItem {...formItemLayoutModal} label="企业基数下限">
                      {getFieldDecorator('corpBaseLwrLmt', {
                        rules: [
                          {
                            required: true,
                            message: '小数点后不可超过2位',
                            pattern: /^-?\d+\.?\d{0,2}$/,
                          },
                        ],
                        initialValue: changeDataMessage.corpBaseLwrLmt,
                      })(
                        <InputNumber
                          max={99999999.99}
                          min={0}
                          style={{ width: '156px' }}
                          placeholder="请输入"
                          disabled={disabledSwitch}
                        />
                      )}
                    </FormItem>
                  </Col>
                  <Col span={12}>
                    <FormItem {...formItemLayoutModal} label="个人基数下限">
                      {getFieldDecorator('empBaseLwrLmt', {
                        rules: [
                          {
                            required: true,
                            message: '小数点后不可超过2位',
                            pattern: /^-?\d+\.?\d{0,2}$/,
                          },
                        ],
                        initialValue: changeDataMessage.empBaseLwrLmt,
                      })(
                        <InputNumber
                          max={99999999.99}
                          min={0}
                          style={{ width: '156px' }}
                          placeholder="请输入"
                          disabled={disabledSwitch}
                        />
                      )}
                    </FormItem>
                  </Col>
                </Row>
                <Row>
                  <Col span={12}>
                    <FormItem {...formItemLayoutModal} label="企业基数进位规则">
                      {getFieldDecorator('corpBaseCarryRule', {
                        rules: [{ required: true, message: '请选择企业基数进位规则' }],
                        initialValue:
                          changeDataMessage &&
                          changeDataMessage.corpBaseCarryRule &&
                          String(changeDataMessage.corpBaseCarryRule),
                      })(
                        <HOCSelect
                          placeholder="请选择"
                          disabled={disabledSwitch}
                          style={{ width: '156px' }}
                        >
                          {localpolicy.dictionaryData.CARRY_RULE
                            ? localpolicy.dictionaryData.CARRY_RULE.map(value => (
                                <Option value={value.itemCode}>{value.itemName}</Option>
                              ))
                            : null}
                        </HOCSelect>
                      )}
                    </FormItem>
                  </Col>
                  <Col span={12}>
                    <FormItem {...formItemLayoutModal} label="个人基数进位规则">
                      {getFieldDecorator('empBaseCarryRule', {
                        rules: [{ required: true, message: '请选择个人基数进位规则' }],
                        initialValue:
                          changeDataMessage &&
                          changeDataMessage.empBaseCarryRule &&
                          String(changeDataMessage.empBaseCarryRule),
                      })(
                        <HOCSelect
                          style={{ width: '156px' }}
                          placeholder="请选择"
                          disabled={disabledSwitch}
                        >
                          {localpolicy.dictionaryData.CARRY_RULE
                            ? localpolicy.dictionaryData.CARRY_RULE.map(value => (
                                <Option value={value.itemCode}>{value.itemName}</Option>
                              ))
                            : null}
                        </HOCSelect>
                      )}
                    </FormItem>
                  </Col>
                </Row>

                <Row>
                  <Col span={12}>
                    <FormItem {...formItemLayoutModal} label="企业缴费比例">
                      <Col span={22}>
                        {getFieldDecorator('corpProp', {
                          rules: [
                            {
                              required: true,
                              message: '小数点后不可超过4位',
                              pattern: /^-?\d+\.?\d{0,4}$/,
                            },
                          ],
                          initialValue: changeDataMessage.corpProp,
                        })(
                          <InputNumber
                            max={99.99}
                            min={0}
                            style={{ width: '140px' }}
                            placeholder="请输入"
                            disabled={disabledSwitch}
                          />
                        )}
                      </Col>
                      <Col
                        span={1}
                        offset={1}
                        style={{ position: 'absolute', top: '2px', right: '-66px' }}
                      >
                        %
                      </Col>
                    </FormItem>
                  </Col>

                  <Col span={12}>
                    <FormItem {...formItemLayoutModal} label="个人缴费比例">
                      <Col span={22}>
                        {getFieldDecorator('empProp', {
                          rules: [
                            {
                              required: true,
                              message: '小数点后不可超过4位',
                              pattern: /^-?\d+\.?\d{0,4}$/,
                            },
                          ],
                          initialValue: changeDataMessage.empProp,
                        })(
                          <InputNumber
                            max={99.99}
                            min={0}
                            style={{ width: '140px' }}
                            placeholder="请输入"
                            disabled={disabledSwitch}
                          />
                        )}
                      </Col>
                      <Col
                        span={1}
                        offset={1}
                        style={{ position: 'absolute', top: '2px', right: '-66px' }}
                      >
                        %
                      </Col>
                    </FormItem>
                  </Col>
                </Row>
                <Row>
                  <Col span={12}>
                    <FormItem {...formItemLayoutModal} label="企业固定金额">
                      {getFieldDecorator('corpFixSum', {
                        rules: [
                          {
                            required: true,
                            message: '小数点后不可超过2位',
                            pattern: /^-?\d+\.?\d{0,2}$/,
                          },
                        ],
                        initialValue: changeDataMessage.corpFixSum,
                      })(
                        <InputNumber
                          style={{ width: '156px' }}
                          max={99999999.99}
                          min={0}
                          placeholder="请输入"
                          disabled={disabledSwitch}
                        />
                      )}
                    </FormItem>
                  </Col>
                  <Col span={12}>
                    <FormItem {...formItemLayoutModal} label="个人固定金额">
                      {getFieldDecorator('empFixSum', {
                        rules: [
                          {
                            required: true,
                            message: '小数点后不可超过2位',
                            pattern: /^-?\d+\.?\d{0,2}$/,
                          },
                        ],
                        initialValue: changeDataMessage.empFixSum,
                      })(
                        <InputNumber
                          max={99999999.99}
                          min={0}
                          style={{ width: '156px' }}
                          placeholder="请输入"
                          disabled={disabledSwitch}
                        />
                      )}
                    </FormItem>
                  </Col>
                </Row>
                <Row>
                  <Col span={12}>
                    <FormItem {...formItemLayoutModal} label="企业缴费进位规则">
                      {getFieldDecorator('corpCarryRule', {
                        rules: [{ required: true, message: '请选择企业缴费进位规则' }],
                        initialValue:
                          changeDataMessage &&
                          changeDataMessage.corpCarryRule &&
                          String(changeDataMessage.corpCarryRule),
                      })(
                        <HOCSelect
                          placeholder="请选择"
                          disabled={disabledSwitch}
                          style={{ width: '156px' }}
                        >
                          {localpolicy.dictionaryData.CARRY_RULE
                            ? localpolicy.dictionaryData.CARRY_RULE.map(value => (
                                <Option value={value.itemCode}>{value.itemName}</Option>
                              ))
                            : null}
                        </HOCSelect>
                      )}
                    </FormItem>
                  </Col>
                  <Col span={12}>
                    <FormItem {...formItemLayoutModal} label="个人缴费进位规则">
                      {getFieldDecorator('empCarryRule', {
                        rules: [{ required: true, message: '请选择个人缴费进位规则' }],
                        initialValue:
                          changeDataMessage &&
                          changeDataMessage.empCarryRule &&
                          String(changeDataMessage.empCarryRule),
                      })(
                        <HOCSelect
                          style={{ width: '156px' }}
                          placeholder="请选择"
                          disabled={disabledSwitch}
                        >
                          {localpolicy.dictionaryData.CARRY_RULE
                            ? localpolicy.dictionaryData.CARRY_RULE.map(value => (
                                <Option value={value.itemCode}>{value.itemName}</Option>
                              ))
                            : null}
                        </HOCSelect>
                      )}
                    </FormItem>
                  </Col>
                </Row>

                <Row>
                  <Col span={12}>
                    <FormItem {...formItemLayoutModal} label="政府发文时间">
                      {getFieldDecorator('govPostTime', {
                        rules: [{ required: false, message: '请选择企业缴费进位规则' }],
                        initialValue:
                          defaultSwitch && changeDataMessage.govPostTime
                            ? moment(changeDataMessage.govPostTime)
                            : null,
                      })(<DatePicker style={{ width: '156px' }} />)}
                    </FormItem>
                  </Col>
                  <Col span={12} />
                </Row>
              </Row>
            </Form>
          </Modal>
        )}

        {/* 生成替数任务 */}
        {duplicateTaskModal && (
          <Modal
            title="生成替数任务"
            visible={duplicateTaskModal}
            onOk={this.duplicateTaskOk}
            onCancel={this.duplicateTaskCancel}
            footer={[
              <Button key="back" onClick={() => this.duplicateTaskCancel()}>
                取消
              </Button>,
              <Button key="submit" type="primary" onClick={() => this.duplicateTaskOk()}>
                确定
              </Button>,
            ]}
            closable={false}
            destroyOnClose
          >
            <Form layout="horizontal">
              <FormItem label="修改内容" {...formModalItemLayout}>
                {getFieldDecorator('difContent')(<span>{taskObj.difContent || '--'}</span>)}
              </FormItem>
              <FormItem label="生效年月" {...formModalItemLayout}>
                {getFieldDecorator('beginDate')(
                  <span>{moment(taskObj.beginDate).format('YYYY-MM') || '--'}</span>
                )}
              </FormItem>
              {(taskObj.stopDate && (
                <FormItem label="结束年月" {...formModalItemLayout}>
                  {getFieldDecorator('stopDate')(
                    <span>{moment(taskObj.stopDate).format('YYYY-MM') || '--'}</span>
                  )}
                </FormItem>
              )) ||
                null}
              <FormItem
                label={
                  <span>
                    <i style={{ color: 'red' }}>*</i> 差额账单处理方式
                  </span>
                }
                {...formItemRadioLayout}
              >
                <DictCode
                  inputType="3"
                  dictType="DIFFER_HDL_WAY_TYPE"
                  onChange={e => this.getValue(e)}
                />
              </FormItem>
            </Form>
          </Modal>
        )}
      </div>
    );
  }
}
export default LocalPolicy;
